package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 结算开票记录
 * </p>
 *
 * @author linan
 * @date 2023-02-02
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionSettlementInvoicingInvoiceTypeEnum", description = "开票类型 #{VAT_PAPER_SPECIAL_INVOICE:增值税纸质专用发票;VAT_PAPER_ORDINARY_INVOICE:增值税纸质普通发票;VAT_ELECTRONIC_SPECIAL_INVOICE:增值税电子专用发票;VAT_ELECTRONIC_ORDINARY_INVOICE:增值税纸质专用发票;-枚举")
public enum ExhibitionSettlementInvoicingInvoiceTypeEnum implements BaseEnum {

    /**
     * VAT_PAPER_SPECIAL_INVOICE="增值税纸质专用发票"
     */
    VAT_PAPER_SPECIAL_INVOICE("增值税纸质专用发票"),
    /**
     * VAT_PAPER_ORDINARY_INVOICE="增值税纸质普通发票"
     */
    VAT_PAPER_ORDINARY_INVOICE("增值税纸质普通发票"),
    /**
     * VAT_ELECTRONIC_SPECIAL_INVOICE="增值税电子专用发票"
     */
    VAT_ELECTRONIC_SPECIAL_INVOICE("增值税电子专用发票"),
    /**
     * VAT_ELECTRONIC_ORDINARY_INVOICE="增值税纸质专用发票"
     */
    VAT_ELECTRONIC_ORDINARY_INVOICE("增值税纸质专用发票"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionSettlementInvoicingInvoiceTypeEnum match(String val, ExhibitionSettlementInvoicingInvoiceTypeEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionSettlementInvoicingInvoiceTypeEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionSettlementInvoicingInvoiceTypeEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "VAT_PAPER_SPECIAL_INVOICE,VAT_PAPER_ORDINARY_INVOICE,VAT_ELECTRONIC_SPECIAL_INVOICE,VAT_ELECTRONIC_ORDINARY_INVOICE", example = "VAT_PAPER_SPECIAL_INVOICE")
    public String getCode() {
        return this.name();
    }

}
